 
//单元格编辑后回调的方法
efgrid_onDataCellSaved = function( grid_id, row_index, col_index, cell_value ) 
{
	  var grid = efgrid.getGridObject( grid_id ); 
	  if( col_index == 1) 
	  { 
		  var info=_getEi();
		  var eiBlock=info.getBlock("cmes.ch.workingface");
		  for(var i=0;i<eiBlock.getRows().length;i++)
		  {
 			  var _value = eiBlock.getCell(i,"value");
			  if(_value==cell_value)
			  {
				  var fdDepartmentId = eiBlock.getCell(i,"fdDepartmentId");
				  var fdCoalTypeId = eiBlock.getCell(i,"fdCoalTypeId");	// 采煤方法
				  var fdRecoveryProcess = eiBlock.getCell(i,"fdRecoveryProcess");	// 回采工艺
				  var fdFrameType = eiBlock.getCell(i,"fdFrameType"); //架型
				  var fdChance = eiBlock.getCell(i,"fdChance");		// 回采率（%）
				  var fdPlanSum = eiBlock.getCell(i,"fdPlanSum"); //计划量
				  var fdDensity = eiBlock.getCell(i,"fdDensity");	// 容重
				  var fdWidth = eiBlock.getCell(i,"fdWidth");	// 宽度（m）
				  var fdHeight = eiBlock.getCell(i,"fdHeight");	// 采高（m）
				  var fdThickness = eiBlock.getCell(i,"fdThickness"); // 煤厚（m）
				  
				  grid.getBlockData().setCell(row_index, "fdDepartmentId", fdDepartmentId);
				  grid.getBlockData().setCell(row_index, "fdAverage", "");
				  grid.getBlockData().setCell(row_index, "fdBoost", "");
				  grid.getBlockData().setCell(row_index, "fdWidth", fdWidth);
				  grid.getBlockData().setCell(row_index, "fdMineHight", fdHeight);
				  grid.getBlockData().setCell(row_index, "fdThickness", fdThickness);
				  grid.getBlockData().setCell(row_index, "fdBulkDensity", fdDensity);
				  
				  grid.refreshCell( row_index, 0 , TYPE_DATA );	
				  grid.refreshCell( row_index, 4 , TYPE_DATA );
				  grid.refreshCell( row_index, 5 , TYPE_DATA );
				  grid.refreshCell( row_index, 6 , TYPE_DATA );
				  grid.refreshCell( row_index, 7 , TYPE_DATA );
				  grid.refreshCell( row_index, 8 , TYPE_DATA );
				  grid.refreshCell( row_index, 9 , TYPE_DATA );
			  }	  
		  }
	  }
	  
	  // 计算面积，煤量
	  if (col_index == 4) {
		var rows = grid.getCheckedRows();
		for (var i = 0; i < rows.length; i++) {
			var width = grid.getCellValueByColumnName(rows[i], "fdWidth"); // 宽度
			var average = grid.getCellValueByColumnName(rows[i], "fdAverage"); // 平均
			var minehight = grid.getCellValueByColumnName(rows[i], "fdMineHight"); // 采高
			var bulkDensity = grid.getCellValueByColumnName(rows[i], "fdBulkDensity"); // 容重

			if (width == null || width == "") {
				return;
			}
			if (average == null || average == "") {
				return;
			}
			// 面积=平均*采面宽度
			var mj = parseFloat(average) * parseFloat(width);
			mj =parseInt(mj);
			
			if (minehight == null || minehight == "") {
				return;
			}
			if (bulkDensity == null || bulkDensity == "") {
				return;
			}

			// 产量=平均*采面宽度*采高*容重
			var cl = parseFloat(average) * parseFloat(width) * parseFloat(minehight) * parseFloat(bulkDensity);
			cl = parseInt(cl);
			grid.setCellValue(rows[i], 9, cl, TYPE_DATA);
			grid.setCellValue(rows[i], 10, mj, TYPE_DATA);

			grid.refreshCell(rows[i], 9, TYPE_DATA);
			grid.refreshCell(rows[i], 10, TYPE_DATA);
		}
	}
}

button_insert_onclick = function (){
	if (isSelected("ef_grid_result") == 0)return; 
	efgrid.submitForm( "ef_grid_result", "ZM","ZMCH71","insert",true);
}

button_update_onclick = function (){
	if (isSelected("ef_grid_result") == 0)return; 
	efgrid.submitForm( "ef_grid_result", "ZM","ZMCH71","update",true);
}

button_delete_onclick = function (){
	var grid=isSelected("ef_grid_result");
	if (grid == 0)return; 
	EFConfirm('你确认要删除吗?', '确认框', function(r) {
		if(r)efgrid.submitForm( "ef_grid_result", "ZM","ZMCH71","delete",true);
	}); 
}

efgrid_onAjaxSubmitSuccess = function(gridId, service_name, method_name, eiInfo) {
	if(gridId == "ef_grid_result") {

		if (eiInfo.status != -1) {
			var grid = efgrid.getGridObject("ef_grid_result");
			grid.refresh( eiInfo );
			window.parent.refresh_main_grid();
		}
		else
		{
			submitCallBackEiMsg = eiInfo.msg;
		}
	} else {
		var grid = efgrid.getGridObject(gridId);
		grid.refresh( eiInfo );
	}
};
